package com.jijs.soap.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPFaultException;


public class ClientTest {

	public static void main(String[] args) throws MalformedURLException {
		//开启eclipse的tcp的monitor代理，监听8088端口，如果不开则应访问8888端口
		URL url = new URL("http://localhost:8088/ms?wsdl");
		QName qname = new QName("http://www.infcn.com.cn/","MyServiceImplService");
		MyServiceImplService mis = new MyServiceImplService(url, qname);
//		MyServiceImplService mis = new MyServiceImplService();
		IMyService ms = mis.getMyServiceImplPort();
		try {
			ms.login("admin", "123456");
			User u = new User();
			u.setId(1);
			u.setNickName("23");
			u.setPassword("23");
			u.setUserName("123");
			Holder<User> holder = new Holder<User>(u);
			ms.addUser(holder);
			System.out.println("ddd");
		} catch (UserException_Exception e) {
			System.out.println(e.getMessage());
		} catch (SOAPFaultException e){
			System.out.println(e.getMessage());
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
}
